package com.my.hotel.util;

import java.io.FileWriter;
import java.io.IOException;

/* *
 *类名：AlipayConfig
 *功能：基础配置类
 *详细：设置帐户有关信息及返回路径
 *修改日期：2017-04-05
 *说明：
 *以下代码只是为了方便商户测试而提供的样例代码，商户可以根据自己网站的需要，按照技术文档编写,并非一定要使用该代码。
 *该代码仅供学习和研究支付宝接口使用，只是提供一个参考。
 */

public class AlipayConfig {

//↓↓↓↓↓↓↓↓↓↓请在这里配置您的基本信息↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓

    // 应用ID,您的APPID，收款账号既是您的APPID对应支付宝账号
//    public static String app_id = "2016091700529306";
    public static String app_id = "2021000118618232";

    // 商户私钥，您的PKCS8格式RSA2私钥
//    public static String merchant_private_key = "MIIEvAIBADANBgkqhkiG9w0BAQEFAASCBKYwggSiAgEAAoIBAQCpBYEe0ffTgHMMoTq7b73yp8ogO/nq+LAWYEmTzY51G2oQPmmg6RY67ZfQApfDlsvIm9Q93fKuIUDOoT69Mj+1wOJp8or0PRkDsVtLWsIL7imprjYVfKZoQJArY/hNBCv9ryE0kR5JYgFxuFL516+fxSj0+76Arfnh56JJMDe+6DqUUqDn+Udlx9kf/IzwpBRtuc3GnmNl5ydTz6bgriv4b3UTaWVFPefrSmpAW5r0+uy/VtjkL695MxvzunbMf35YtpVxi/6luc6Nn5u2NHuo3kEYZbfOrF7GmuARj9IDv8Ol4jHAXiHjk+Ox6EUu8I3krdAlzIhW7BxcT+TWjDyLAgMBAAECggEAauczWrX85IYKvoM/bYvofRDJFAg7MvXmEdEG2Hgb0U/sjqebEY47ZDwgWA07xhabf5+n5xV5R896ePadgvbEOwXrbo1ce8wlBSPpFUkrEHarXUn1pTN44NltFjSduMCZvlNFUkUy/cECHtYxjRpxV0FRfVm4jRT8xnhGObpIl/KnmQlcCipw+2glE9sd7dCfqnaiux0eGltL5TCslHb5E7rMgtmFarYeO4ZmtpUV3L6Rox9m0oxUpgnTxA4qTU2PtVQkLP6GrAI+gnf6bD8q8yzKSLgWcaLFg/7yMTQWg2jtOT6koiZZ3ETYWdCWmHGrfr/xTa5IF/k3gU5Q9gvTwQKBgQD+W2G/yjMRJwyG67Ik70bXAr+rSqX76HMIsvuyzt2TymDK2wyUTiEIX0GEvCux//9ffsnQWvLdZTWcgplFDgCaGNYRfwPNQc9sMkwLca3xmcarwsSK455fFySi2/lBBtdYv/RbKEBj4gpEUyl1ZgV1K1Vi3guI733tFDtLwdj3IQKBgQCqHQHedRfhyJDwSlzDN/ZoN3+ghM2KrYMzJeEj+DMdxip64JupSIPQiRKSpCL8s9xOISbtKh1I8D85Qkqjlsj45X4fe2sATnxINAtUgfRI9k9AK8Kqrly0ULnSUJThz0oa5+5O8lD3MqNqbPZ6ssafJ1fFmujglZma3q65R7V6KwKBgCzZqC7NVJvdqtPPk6X3myImle16SDJXFpGeHcu1tlRtBww9+8Xa0PBM+5yQIZRNc5Y/IQ7gOprXUdC7JpOKmIiTgIutPdpflFebttT9wpIrb2CyAz4KTM6vogIlj5nrvuUjU88PFeuG3BCYKWNODgBPF8tLI/WNZUL8okgFcmCBAoGAWIlCWMJ+jH9zl+xL/TqaH0GLRkL4Kw4Fc9BqLetWx09E+rD9swxPtnAw32tX3kfKCEvO066QkU6gyS9MY3nt3USr8LyuQvmWS4nyv6fnOTYgpxhfd6/KBfrhy6ku45ucSQafDC2noBCV5qURX2i+YUT7tJfcTk7uJCFztHCy7gMCgYAHOhtwJV4QKtRC7etOWKckwd05qVpWm1wgkL+6sd4UBW83TOfrPdnFPjrr5upAWuBCI+ufY4uvl57soY3x0OMr0mX69bIw1wjKeUXn5TceCo4ogBxnXYOoiqGScEn2gk638UHihzCukd2F/wHK1rIovLkZvJQ/ka4vSEUUQdgX0Q==";
    public static String merchant_private_key = "MIIEvgIBADANBgkqhkiG9w0BAQEFAASCBKgwggSkAgEAAoIBAQDH6WYTksRGUBu/2YxcLkUfPU/L+RTjjOotczCorsKeQc6rmeW7PQ8OyjvZYxn2ws/JKFdKxElIRiLPabLu+wn17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SJIGPUYlUR3j1Bu+4djib4KVc8Wfya3YvN6kx8+1//AoGBAL8O12C7YtN6AlosIoLqSoANwwfOKz9OC/0yU9Pl/nSY3u4mZ3bcIogrHBQtSGW2cN0GoOOlFWq/KiRCCO/PyZGrO1UuXMJne1LnuWDGcHt765GCd5LKz+ruJ/ktaqBOtIqgK5cfZHX8bEKrsApaT1ThCO+/r8kjM7i6FKV25L1VAoGBANcvNTqIFBNASF4HnyrzgAVbnwSgcptNJBNHdBfNdBhYY4xAFYUGWZxtknQLIHE1nnD2nqsmYo5w2Pz272ZcrUW2mAUingOyxg0wd8GCs1bU3qIjGkXVqN1te9y3rSJHkzdS8/nrsvI9BQZooNxhPfK59AnWK6QJ7qz/TnX46Mue";

    // 支付宝公钥,查看地址：https://openhome.alipay.com/platform/keyManage.htm 对应APPID下的支付宝公钥。
//    public static String alipay_public_key = "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEApCEbwf8/0eY309Fc5RWPMzwOUcAdPdL3Ru5B1SgvTxy97bBZlV/ZnAJmaGOM+3g2DTnV7j1RL0cFUf4iQBA74TArYnqP717O/qsiFtzDy70qbdx49ZPJcmtDzj5yNuybYrsMcwLOK5EFFZOPHVtIbTrs6n93QYnkopXkOsnRVE1w8oUTYjmpTmoi0SKeFPY7mysou2QZAhOhWVTliwnVOmVEIQxWDVKof23tjlXJVnoKSTGn0RFqy90mcCUlgu75Fv0lpzd4fhRCrZdcaz9VGFEK0hJrSsbLXkBQz33UXJjUhPWyzIyuPy0mvIUzu7oRnCEfdQEg7rRoK3hV/XKB5wIDAQAB";
    public static String alipay_public_key = "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAwwONvxz3YpUiUqMzk3CDTUCg+bVt0NV2rgNJcvg96oTzjPQDSbW93UpZkLbCsdX3ld0Iw47R7QySm1ONMz6J/U/r1MgHvAki8pYImBgjJ+c1ScGSxPn2cFPqdYGWJmSAKm0UK0UwMP8K+2giMLhykGMMz61rRE28K/lknHkLn0Xu27ESAnwTjr0E5N22aHUyO2/pwXFaxYixYZLEVxTePyHR8fyx8P/2YZzRs+0T8CqK1oLlld80f5X3D6RS1ES4FEkwpYbPCUVXNTa9Hh3hcD1VY6DUmLkyIw1KY4QERziaHlHZMLS6ECWaFtEERt47ToKxndsZ6Gp9e7TKwEqJPwIDAQAB";
    // 服务器异步通知页面路径  需http://格式的完整路径，不能加?id=123这类自定义参数，必须外网可以正常访问
    public static String notify_url = "http://工程公网访问地址/alipay.trade.page.pay-JAVA-UTF-8/notify_url.jsp";

    // 页面跳转同步通知页面路径 需http://格式的完整路径，不能加?id=123这类自定义参数，必须外网可以正常访问
    public static String return_url = "http://127.0.0.1:9000/utils/success";

    // 签名方式
    public static String sign_type = "RSA2";

    // 字符编码格式
    public static String charset = "utf-8";

    // 支付宝网关
    public static String gatewayUrl = "https://openapi.alipaydev.com/gateway.do";

    // 支付宝网关
    public static String log_path = "C:\\";


//↑↑↑↑↑↑↑↑↑↑请在这里配置您的基本信息↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑

    /**
     * 写日志，方便测试（看网站需求，也可以改成把记录存入数据库）
     * @param sWord 要写入日志里的文本内容
     */
    public static void logResult(String sWord) {
        FileWriter writer = null;
        try {
            writer = new FileWriter(log_path + "alipay_log_" + System.currentTimeMillis()+".txt");
            writer.write(sWord);
        } catch (Exception e) {
            e.printStackTrace();
        } finally {
            if (writer != null) {
                try {
                    writer.close();
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
        }
    }
}

